﻿
@{
    ViewData["Title"] = "ProcuredAdd";
    Layout = "~/Views/Home/Menu.cshtml";
}

<div style="font-size:20px;color:gray;margin:10px;padding:16px">
    采购申请添加
</div>
<form class="layui-form" action="">
    <div class="layui-form-item" style="margin-left:240px">
        <div class="layui-inline">
            <label class="layui-form-label">采购编号:</label>
            <div class="layui-input-block">
                <input type="text" name="ProcuredNumber" lay-verify="required" id="ProcuredNumber" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" style="width:auto">采购原料编号:</label>
            <div class="layui-input-inline">
                <input type="text" name="FeedstockNumber" lay-verify="required" id="FeedstockNumber" autocomplete="off" class="layui-input">
            </div>
        </div>
   </div>

    <div class="layui-form-item" style="margin-left:230px">
        <div class="layui-inline">
            <label class="layui-form-label" style="width:auto">采购原料名称:</label>
            <div class="layui-input-inline">
                <input type="text" name="FeedstockName" lay-verify="required" id="FeedstockName" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline" style="margin-left:-18px">
            <label class="layui-form-label" style="width:auto">采购原料数量:</label>
            <div class="layui-input-inline">
                <input type="number" id="FeedstockNum" name="FeedstockNum" min="0" lay-affix="number"  class="layui-input">
            </div>
        </div>
   </div>

    <div class="layui-form-item" style="margin-left:230px">
        <div class="layui-inline">
            <label class="layui-form-label" style="width:auto">采购原料型号:</label>
            <div class="layui-col-md6">
                <select id="Feedstocktype" name="Feedstocktype" lay-verify="required" lay-filter="mySelectFilter" class="dialog-select"></select>
            </div>
        </div>
        <div class="layui-inline" style="margin-left:-30px">
            <label class="layui-form-label" style="width:auto">采购原料尺寸:</label>
            <div class="layui-col-md6">
                <select id="FeedstockSize" name="FeedstockSize" lay-verify="required" lay-filter="mySelectFilter" class="dialog-select"></select>
            </div>
        </div>
   </div>

    <div class="layui-form-item" style="margin-left:240px">
        <div class="layui-inline">
            <label class="layui-form-label">申请日期：</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" id="AddTime" name="AddTime" placeholder="请选择日期">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">采购预算:</label>
            <div class="layui-input-inline">
                <input type="text" name="ProcuredBudget" lay-verify="required" id="ProcuredBudget" autocomplete="off" class="layui-input">
            </div>
        </div>
   </div>

    <div class="layui-form-item" style="margin-left:245px">
        <div class="layui-inline">
            <label class="layui-form-label" style="width:auto">采购批次号:</label>
            <div class="layui-input-inline">
                <input type="text" name="LotNumber" lay-verify="required" id="LotNumber" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" style="width:auto">采购单价:</label>
            <div class="layui-input-inline">
                <input type="text" name="ProcessPrice" lay-verify="required" id="ProcessPrice" autocomplete="off" class="layui-input">
            </div>
        </div>
   </div>
    @* 付款方式 *@
    <div class="layui-form-item" style="margin-left:240px">
        <label class="layui-form-label">付款方式:</label>
        <div class="layui-inline">
            <input type="radio" name="PayMethods" value="定金+尾款" title="定金+尾款" checked>
            <input type="radio" name="PayMethods" value="全款" title="全款">
        </div>
    </div>
    <br />
    <div class="layui-form-item" style="margin-left:500px">
        <button class="layui-btn" lay-submit lay-filter="demo-login">确认</button>
        <button type="reset" class="layui-btn layui-btn-primary">取消</button>
    </div>
</form>
<script src="~/js/procuredcg/procuredadd.js"></script>
<script>
    layui.use(function () {
        var laydate = layui.laydate;
        // 日期选择器
        laydate.render({
            elem: '#AddTime',
        });
    });
$(function () {
    fantian();
});
//采购申请反填
function fantian() {
    layui.use('layer', function () {
        var form = layui.form;
        var procuredId = localStorage['rawMaterialId']
        // 创建表格实例
        $.ajax({
            url: "/RawMaterial/RawMaterMondel",
            type: "get",
            data: {
                rawMaterialId: procuredId,
            },
            success: function (data) {
                data = JSON.parse(data);
                console.log(data.data);
                // 在 ajax 请求成功后，使用正确的表格 ID 进行 reload
                $(data.data).each(function () {
                    $("#FeedstockNumber").val(this.rawMaterialNumbering)
                    $("#FeedstockName").val(this.rawMaterialName)
                    $("#Feedstocktype").val(this.rawMaterialSpecModel)
                    $("#FeedstockSize").val(this.rawMaterialSize)
                    form.render('select')
                })
            }
        });
    })
}
</script>
